<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Hình thức thai sản';
$this->template->display('dsp_header.php');
?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');

    echo $this->hidden('hdn_dsp_single_method','dsp_single_loaithaisan');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_loaithaisan');
    echo $this->hidden('hdn_update_method','update_loaithaisan');
    echo $this->hidden('hdn_delete_method','delete_loaithaisan');
    $v_row = 0;
    ?>
   <div id="div_filter">
        <input class = 'button' type="button" name="btn_add_loaithaisan" value="Thêm hình thức thai sản" onclick="row_loaithaisan_onclick_pop_win('0')"/>
	</div>
    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="50%" />
            <col width="28%" />
            <col width="6%" />
            <col width="8%" />
            <col width="8%" />
        </colgroup>
        <tr>
            <th>Tên hình thức thai sản</th>
            <th>Phần trăm giảm giờ</th>
            <th>Thứ tự</th>
            <th>Trạng thái</th>
            <th>Thao tác</th>
        </tr>
        <?php while ($arr = $arr_all_loaithaisan->FetchRow()): ?>
            <?php
            $id=1;
             $MA_LOAI_THAI_SAN=$arr['MA_LOAI_THAI_SAN'];
             $TEN_LOAI_THAI_SAN=$arr['TEN_LOAI_THAI_SAN'];
             $PHAN_TRAM_GIAM_GIO=$arr['PHAN_TRAM_GIAM_GIO'].'%';
             $STT_LOAI_THAI_SAN=$arr['STT_LOAI_THAI_SAN'];
             $TEN_TRANG_THAI=$arr['TEN_TRANG_THAI'];
             $v_class = 'row' . ($v_row % 2);
             $v_row++;
            ?>
            <tr class="<?php echo $v_class;?>">
                <td><?php echo $TEN_LOAI_THAI_SAN;?></td>
                <td style="text-align:center"><?php echo $PHAN_TRAM_GIAM_GIO;?></td>
                <td style="text-align:center"><?php echo $STT_LOAI_THAI_SAN;?></td>
                <td style="text-align:center"><?php echo $TEN_TRANG_THAI;?></td>
                <td style="text-align:center">
                    <a href="javascript:void(0)" onclick="row_loaithaisan_onclick_pop_win('<?php echo $MA_LOAI_THAI_SAN;?>')">Sửa</a> |
                    <a href="javascript:void(0)" onclick="quick_delete_loaithaisan('<?php echo $MA_LOAI_THAI_SAN;?>')">Xoá</a>
                </td>
            </tr>
        <?php endwhile; ?>
        <?php echo $this->add_empty_rows($v_row +1, _CONST_DEFAULT_ROWS_PER_PAGE, 5); ?>
    </table>

</form>
<script>
    function row_loaithaisan_onclick_pop_win(maloaithaisan){
        var url = '<?php echo $this->get_controller_url();?>dsp_single_loaithaisan/'  + maloaithaisan
            url += '/?&maloaithaisan=' + maloaithaisan + '&hdn_item_id=' + maloaithaisan + '&pop_win=1';
        showPopWin(url ,600,270, null);
    }
    function quick_delete_loaithaisan(maloaithaisan)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  maloaithaisan;
            m = $("#controller").val() + 'delete_loaithaisan'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }
</script>
<?php $this->template->display('dsp_footer.php');